home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 014a / vgakit34.zip / XPOINT.ASM < prev    next >
Assembly Source File  |  1990-05-04  |  1KB  |  88 lines

  1.  
  2.     include    model.h
  3.  
  4. ;
  5. ;    VGAKIT Version 3.4
  6. ;
  7. ;    Copyright 1988,89,90 John Bridges
  8. ;    Free for use in commercial, shareware or freeware applications
  9. ;
  10. ;    XPOINT.ASM
  11. ;
  12. ;
  13. .data
  14.  
  15.     extrn    curbk:word
  16.     extrn    maxx:word,maxy:word
  17.  
  18. .code
  19.  
  20.     extrn    newbank:proc
  21.  
  22.     public    xpoint
  23.     public    xpoint13x
  24.  
  25. xpoint    proc    xpos:word,ypos:word,color:word
  26.     mov    bx,[xpos]
  27.     mov    ax,[ypos]
  28.     mov    dx,[maxx]
  29.     cmp    bx,0
  30.     jl    nope1
  31.     cmp    bx,dx
  32.     jge    nope1
  33.     cmp    ax,0
  34.     jl    nope1
  35.     cmp    ax,[maxy]
  36.     jge    nope1
  37.     mul    dx            ;640 dots wide in most cases
  38.     add    bx,ax
  39.     adc    dx,0
  40.     mov    ax,dx
  41.     cmp    ax,[curbk]
  42.     jz    nonew
  43.     call    newbank            ;switch banks if a new bank entered
  44. nonew:    mov    ax,0a000h        ;setup screen segment A000
  45.     mov    es,ax
  46.     mov    al,byte ptr [color]    ;get color of pixel to plot
  47.     xor    es:[bx],al
  48. nope1:    ret
  49. xpoint    endp
  50.  
  51. xpoint13x proc    xpos:word,ypos:word,color:word
  52.     mov    bx,[xpos]
  53.     mov    ax,[ypos]
  54.     mov    dx,[maxx]
  55.     cmp    bx,0
  56.     jl    nope2
  57.     cmp    bx,dx
  58.     jge    nope2
  59.     cmp    ax,0
  60.     jl    nope2
  61.     cmp    ax,[maxy]
  62.     jge    nope2
  63.     shr    dx,1
  64.     shr    dx,1
  65.     mul    dx        ;360 dots wide (for 360x480 mode)
  66.     mov    cx,bx
  67.     shr    bx,1
  68.     shr    bx,1
  69.     add    bx,ax
  70.     mov    ax,102h    
  71.     and    cl,3
  72.     shl    ah,cl            ;create bit plane mask
  73.     mov    dx,3c4h
  74.     out    dx,ax            ;set EGA bit plane mask register
  75.     mov    dl,0ceh
  76.     mov    al,4
  77.     mov    ah,cl
  78.     out    dx,ax            ;set EGA bit plane read regsiter
  79.     mov    ax,0a000h        ;setup screen segment A000
  80.     mov    es,ax
  81.     mov    al,byte ptr [color]    ;get color of pixel to plot
  82.     xor    es:[bx],al
  83. nope2:    ret
  84. xpoint13x endp
  85.  
  86.     end
  87.  
  88.